package com.dao.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.dao.BaseDao;
import com.dao.MusicTypeDao;
import com.entity.MusicType;

@Repository
public class MusicTypeDaoImpl extends BaseDao implements MusicTypeDao{

	@Override
	public List<Map<String, Object>> queryMusicType() {
		String sql ="select musicTypeId,musicTypeName from musicType";
		return executeQuery(sql, null);
	}

	@Override
	public Map<String, Object> queryMusicTypeId(int musicTypeId) {
		String sql ="select musicTypeId,musicTypeName from musicType where musicTypeId=?";
		Object[] params={musicTypeId};
		return executeQueryMap(sql, params);
	}

	@Override
	public int addMusicType(MusicType musicType) {
		String sql ="insert into musicType(musicTypeName)values(?)";
		Object[] params={musicType.getMusicTypeName()};
		return executeUpdate(sql, params);
	}

	@Override
	public int editMusicType(MusicType musicType) {
		String sql ="update musicType 	set musicTypeName=?	where musicTypeId=?";
		Object[] params={musicType.getMusicTypeName(),musicType.getMusicTypeId()};
		return executeUpdate(sql, params);
	}

	@Override
	public int delMusicType(int musicTypeId) {
		String sql ="delete from musicType where musicTypeId=?";
		Object[] params={musicTypeId};
		return executeUpdate(sql, params);
	}

}
